<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"></meta>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"></meta>
<title>登录</title>
<span th:replace="common-easyui-mobile::easyui_mobile_js_css"></span>

<style type="text/css">
.detailTable th{
border:1px solid;
border-color: #ddd;
border-width: 0 1px 1px 0;
border-style: dotted;
margin: 0;
padding: 0;
padding: 0 4px;
text-align: right;
}


.detailTable td{
border:1px solid;
border-color: #ddd;
border-width: 0 1px 1px 0;
border-style: dotted;
margin: 0;
padding: 0 4px;
text-align: right;
}
</style>

</head>
<body>

<table id="dgTable">
	</table>
	<div id="tb">
		<div class="m-toolbar">
			<div class="m-title">
				
			</div>
			 <div class="m-left">
                    <a th:href="@{/index}" class="easyui-linkbutton m-back" plain="true" outline="true">首页</a>
                </div>
                
              <div class="m-right">
                    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" outline="true">添加</a>
                </div>   
		</div>
	</div>
	
	
	<script th:inline="javascript">
	 $('#dgTable').datagrid({  
			url:ctx+'/stock/list',
			method:'post',
		    queryParams: {
			},
			fit:true,
			pageSize: 10,
			fitColumns:true,
			striped: true,
			singleSelect:true,
			pagination: false,  
			rownumbers: true,  
			columns:[[
			          {field:'id',title: '栏目',align: 'center',width: 58,hidden:true},
			          {field:'code',title: '代码',align: 'center',width: 65},
			          {field:'name',title: '名称',align: 'center',width: 60}, 
			          {field:'currentPrice',title: '当前价',align: 'center',width: 60,formatter:function(val,rec){
			        		if(parseFloat(val)>0){
								return '<span style="color:red">'+val+'</span>'		        		 
				        	 }else{
				        		return '<span style="color:green">'+val+'</span>'
				        	 }
				       }}  ,    
					  {field:'daySumFl',title: '当日总盈亏',align: 'center',width: 60,formatter:function(val,rec){
				        	 if(parseFloat(val)>0){
								return '<span style="color:red">'+val+'</span>'		        		 
				        	 }else{
				        		return '<span style="color:green">'+val+'</span>'
				        	 }
				          }}
			]]
			,toolbar:$('#tb')
			,view: detailview,
		    detailFormatter: function(rowIndex, rowData){
		           return '<table class="detailTable">'+
		           		  '<tr><td>昨收</td><td>'+rowData.yesterdayPrice+'</td><td>今开</td><td>'+rowData.startPrice+'</td></tr>'+
		           		  '<tr><td>最低</td><td>'+rowData.miniPrice+'</td><td>最高</td><td>'+rowData.maxiPrice+'</td></tr>'+
		           		  '<tr><td>数量</td><td>'+rowData.buyCount+'</td><td>当日盈亏</td><td>'+rowData.dayFl+'</td></tr>'+
		           		  '<tr><td>买入价</td><td>'+rowData.buyPrice+'</td><td>总比率</td><td>'+rowData.flPercent+'</td></tr>'+
		                  '</table>';
		    }
			
		  });
	
	 //每隔10秒刷新一次
	 //setTimeout(function(){location.reload()},8000); 
	</script>
</body>
</html>